package com.micro.mic_common.utils;

import com.micro.mic_common.enums.ResultEnums;
import com.micro.mic_common.other.ResponseData;

/**
 * @Description 返回数据操作工具类
 * @Author yijian
 * @Date 2021/12/28 18:33
 **/
public class ResponseDataUtil {

    public static <T>ResponseData success(T data){
        return new ResponseData(ResultEnums.SUCCESS,data);
    }

    public static <T>ResponseData success(){
        return new ResponseData(ResultEnums.SUCCESS);
    }

    public static <T>ResponseData success(String msg){
        return new ResponseData(ResultEnums.SUCCESS.getCode(),msg);
    }

    public static <T>ResponseData success(String code,String msg){
        return new ResponseData(code,msg);
    }

    public static <T>ResponseData success(String code,String msg,T data){
        return new ResponseData(code,msg,data);
    }

    public static <T>ResponseData success(ResultEnums resultEnums){
        return new ResponseData(resultEnums);
    }

    public static <T>ResponseData error(T data){
        return new ResponseData(ResultEnums.ERROR,data);
    }

    public static <T>ResponseData error(){
        return new ResponseData(ResultEnums.ERROR);
    }

    public static <T>ResponseData error(String msg){
        return new ResponseData(ResultEnums.ERROR.getCode(),msg);
    }

    public static <T>ResponseData error(String code,String msg){
        return new ResponseData(code,msg);
    }

    public static <T>ResponseData error(String code,String msg,T data){
        return new ResponseData(code,msg,data);
    }

    public static <T>ResponseData error(ResultEnums resultEnums){
        return new ResponseData(resultEnums);
    }
}
